<template>
  <div class="header">
    <mt-header
      fixed
      :title="$route.meta.title"
      class="mui-bar mui-bar-nav mui-bar-transparent"
    >
      <span slot="left" @click="goBack" v-show="showBack">
        <mt-button icon="back">返回</mt-button>
      </span>
    </mt-header>
  </div>
</template>

<script>
export default {
  name: "Header",
  props: ["showBack"],
  created() {
    this.showBack = this.$route.path !== "/home"; // 初始判断不否为首页，判断是否显示返回按钮
  },
  methods: {
    goBack() {
      this.$router.go(-1); //返回上一页面
    },
  },
};
</script>

<style>
</style>